package com.richpay.basejava.base15;

/**
 * 老师
 */
public class Teacher {
    private String name;
    private Computer cmp;

    public Teacher(String name) {
        this.name = name;
        this.cmp = new Computer();
    }

    public void preFlect() throws NoPlanException {
        try {

            cmp.run();
            System.out.println(name + "在讲课");
        } catch (LanPingException e) {
            System.out.println(e.getMessage());
            cmp.reset();
            preFlect();

        } catch (MaoYanException e) {
            System.out.println("讲课:"+e.getMessage());
            //test();
            RepairComputer repairComputer=new RepairComputer();
            repairComputer.repair(cmp);
            preFlect();

        }

    }

    void test(){
        System.out.println("大家做练习");
    }

}
